<?php
namespace Modules\Category\Providers;
use Konekt\Concord\BaseModuleServiceProvider;
use Modules\Category\Models\Category;
use Modules\Category\Observers\CategoryServer;
use Modules\Category\Services\CategoryService;
class ModuleServiceProvider extends BaseModuleServiceProvider{

    public function register(){
        parent::register();
        $this->loadRoutesFrom(__DIR__.'/../Http/routes.php');

    }
    //boot()在所有Provider注册完成后执行
    public function boot(){
        parent::boot();//调用父类的boot()
        $this->loadMigrationsFrom(__DIR__ . '/../Database/Migrations');
        $helpers = __DIR__ . '/../Helpers/helpers.php';
        if (file_exists($helpers)) {
            require_once $helpers;
        }
        $helpers2 = __DIR__ . '/../Helpers/helpers2.php';
        if (file_exists($helpers2)) {
            require_once $helpers2;
        }

        // 注册模型观察者
        Category::observe(CategoryServer::class);
    }

}